<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="include/base.jsp" %>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="css/loong.css" />
	<link rel="stylesheet" type="text/css" href="css/jquery.css"/>
</head>
<body class="body">
	
	<%@ include file="include/top.jsp" %>
	
	
	
	<div class="container">
	  <div class="row row-inner">
		 <%@ include file="include/left.jsp" %>
		<div class="span5">
		  
		  	<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;">
				<li class="active">
					<i class="icon-th"></i>你在想什么？
				</li>
			</ul>
			<div class="wall">
			
				<!-- <form style="margin:0px"> -->
					<textarea name="content" id="msg" class="span3" style="width:315px" rows="3"></textarea>
					<button  id="btn" class="btn btn-primary">发布</button>
				<!-- </form> -->
			</div>
			
			<c:forEach items="${requestScope.nameList }" var="name">
				<div id="name" style="display:none">${name }</div>
			</c:forEach>
			<div></div>
				
			 
			<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:20px">
				<li class="active">
					<i class="icon-th"></i>信息流
				</li>
			</ul>
			<div class="wall" id="show">
				<c:if test="${not empty sessionScope.message}">
					<c:forEach items="${sessionScope.message}" var="item" >
						<blockquote>
							<h5 id="m_c">${item.content }</h5>
							<h6 id="m_ct">发表于${item.time}</h6>
						</blockquote>
					</c:forEach>
				</c:if>
			 
				
			</div>
		</div>
		<div class="span2">
			<div class="box">
				<div class="head">我的任务</div>
				<ul>
				<c:if test="${not empty sessionScope.listtask}">
					<c:forEach items="${sessionScope.listtask}" var="item" >
							<li><a href="myTask.jspx?id=${item.id}">${item.name}</a></li>
					</c:forEach>
				</c:if>
					
				</ul>
			</div>
		</div>
	  </div>
	</div>
	<script type="text/javascript" src="js/jquery.atwho.js"></script>
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript"  src="js/json.js"></script>
	<script type="text/javascript">
	
	$(document).ready(function(){
	
	

		var xmlHttp;
		//创建引擎
		function createXmlHttp(){
			if(window.ActiveXObject){
				//IE
				xmlHttp=new ActiveXobject("Microsoft.XMLHTTP");
			}else{
				//chrome firefox
				xmlHttp=new XMLHttpRequest();			
			}
		}
		
		function callback(){
			var serverCode=xmlHttp.readyState;
			if(serverCode==4){
				var httpCode=xmlHttp.status;
				if(httpCode==200){
					//接受服务器返回的字符串
					
					var json=JSON.parse(xmlHttp.responseText);
					
						$("#show").after("<blockquote><h5></h5><h6></h6></blockquote>");
						$("h5").first().html(json.content);
						$("h6").first().html("发表于"+json.time);
					
				}else{
					alert("服务器忙请稍后。。。。");
				}
			}
		}
		document.getElementById("btn").onclick=function(){
			
			//创建Ajax引擎
			createXmlHttp();
			//告诉引擎请求的服务器
			var content=document.getElementById("msg").value;
			xmlHttp.open("post","ajaxProject.jspx",true);
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//3.设置回调函数
			xmlHttp.onreadystatechange = callback;
			//请求服务器
			xmlHttp.send("content="+content);
			
		};
		
	
	});
	
	</script>
</body>
</html>
